
/**
 * Project Name:cats-core-impl
 * File Name:CoreCofig.java
 * Package Name:com.catsic.core.config
 * Date:2014年3月4日下午2:48:22
 * Copyright (c) 2014, oa.catsic.com All Rights Reserved.
 */
 
package com.catsic.core.config;

import org.aspectj.lang.annotation.Aspect;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.context.annotation.ImportResource;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Controller;


/**
 * ClassName: CoreCofig
 * Description: 系统配置文件，
 * date: 2014年3月4日 下午2:48:22
 * author: yangyd
 */
@Configuration
@ImportResource({"classpath*:/config/spring/applicationContext-resource.xml"})
@ComponentScan(basePackages={"com.catsic"},includeFilters = {
		@ComponentScan.Filter(type = FilterType.ANNOTATION, value = Aspect.class)}, excludeFilters = {
		@ComponentScan.Filter(type = FilterType.ANNOTATION, value = Controller.class)})
public class CoreConfig {
	
	
   /**
	* passwordEncoder:用来给密码加密，以保证数据库中存储的密码是密文
	* @author yangyd
	* @return PasswordEncoder
	*/
	@Bean
	public PasswordEncoder passwordEncoder(){
		return new BCryptPasswordEncoder(8);
	}
	
	/**
	 * saltSource:通过动态的加密盐进行加密，该配置通过用户名提供加密盐, 
	 * 通过UserDetails的getUsername()方式
	 * @author yangyd
	 * @return SaltSource
	 */
/*	@Bean
	public SaltSource saltSource(){
		ReflectionSaltSource saltSource = new ReflectionSaltSource();
		saltSource.setUserPropertyToUse("username");
		return saltSource;
	}*/
}
